package test2;

import java.util.List;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.tedu.store.bean.Area;
import cn.tedu.store.bean.City;
import cn.tedu.store.bean.Province;
import cn.tedu.store.mapper.DictMapper;
import cn.tedu.store.service.DictService;
import cn.tedu.store.service.IDictService;

public class test {
	@Test
	public void testGetProvince(){
		ApplicationContext ac = 
				new ClassPathXmlApplicationContext(
						"spring-dao.xml");
		DictMapper dm=ac.getBean("dictMapper",DictMapper.class);
		System.out.println(dm.getCities("110000"));
//		System.out.println(dm.getProvinceByCode("110000"));
		List<Province> p=dm.getProvinces();
		List<City> c=dm.getCities("110000"	);
		List<Area> a=dm.getAreas("110100");
		System.out.println(a.size());
	}
	@Test
	public void testServiceGet(){
		ApplicationContext ac = 
				new ClassPathXmlApplicationContext(
						"spring-dao.xml","spring-service.xml");
		IDictService is=ac.getBean("dictService",IDictService.class);
		System.out.println(is.getProvinces().size());
		System.out.println(is.getCities("110000"));
		System.out.println(is.getAreas("110100"));
	}
}
